<?php
/**
 * 粉粉闺蜜机器人
 * Created by PhpStorm.
 * User: deng
 * Date: 2016/4/26
 * Time: 11:33
 */
class PinkRobot extends AdminBase{

    protected $do;

    function __construct(){
        parent::__construct();
        $this->do = 'getRobotList';
        $this->{$this->op}();
    }

    function indexAction(){
        include_once template("admin_v2/robot");
        exit();
    }

    function listAction(){
        $this->fetchData(array_merge([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'list',
        ], $this->req));
    }

    function msgdetailAction(){
        $this->fetchData([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'detail',
            'id' => $this->req['id']
        ]);
    }

    function editdetailAction(){
        $this->req['content'] = urlencode($this->req['content']);
        $this->fetchData(array_merge([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'edit',
        ], $this->req));
    }

    function addAction(){
        $this->req['content'] = urlencode($this->req['content']);
        $this->fetchData(array_merge([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'add',
        ], $this->req));
    }

    function deleteAction(){
        $this->fetchData([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'delete',
            'id' => $this->req['id']
        ]);
    }

}

new PinkRobot;